﻿namespace HRM.CORE
{

    using APP.HELPER.Data.Helper;
    using System; using Extra.ERP;
    using System.ComponentModel;
    using System.Data.SqlClient;

    public class HRM_PROCESS_PETITIONSHIFT
    {
        private Guid m_PetitionID;
        private string m_ShiftCode;

        public HRM_PROCESS_PETITIONSHIFT()
        {
            this.m_PetitionID = Guid.Empty;
            this.m_ShiftCode = "";
        }

        public HRM_PROCESS_PETITIONSHIFT(Guid PetitionID, string ShiftCode)
        {
            this.m_PetitionID = PetitionID;
            this.m_ShiftCode = ShiftCode;
        }

        public string Delete()
        {
            string[] myParams = new string[] { "@PetitionID", "@ShiftCode" };
            object[] myValues = new object[] { this.m_PetitionID, this.m_ShiftCode };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_PROCESS_PETITIONSHIFT_Delete", myParams, myValues);
        }

        public string Delete(Guid PetitionID, string ShiftCode)
        {
            string[] myParams = new string[] { "@PetitionID", "@ShiftCode" };
            object[] myValues = new object[] { PetitionID, ShiftCode };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_PROCESS_PETITIONSHIFT_Delete", myParams, myValues);
        }

        public bool Exist(Guid PetitionID, string ShiftCode)
        {
            bool hasRows = false;
            string[] myParams = new string[] { "@PetitionID", "@ShiftCode" };
            object[] myValues = new object[] { PetitionID, ShiftCode };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader("HRM_PROCESS_PETITIONSHIFT_Get", myParams, myValues);
            if (reader != null)
            {
                hasRows = reader.HasRows;
                reader.Close();
                helper.Close();
                reader = null;
            }
            return hasRows;
        }

        public string Get(Guid PetitionID, string ShiftCode)
        {
            string str = "";
            string[] myParams = new string[] { "@PetitionID", "@ShiftCode" };
            object[] myValues = new object[] { PetitionID, ShiftCode };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader("HRM_PROCESS_PETITIONSHIFT_Get", myParams, myValues);
            if (reader != null)
            {
                while (reader.Read())
                {
                    this.m_PetitionID = reader.GetGuid(reader.GetOrdinal("PetitionID"));
                    this.m_ShiftCode = Convert.ToString(reader["ShiftCode"]);
                    str = "OK";
                }
                reader.Close();
                helper.Close();
                reader = null;
            }
            return str;
        }

        public string Insert()
        {
            string[] myParams = new string[] { "@PetitionID", "@ShiftCode" };
            object[] myValues = new object[] { this.m_PetitionID, this.m_ShiftCode };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_PROCESS_PETITIONSHIFT_Insert", myParams, myValues);
        }

        public string Insert(Guid PetitionID, string ShiftCode)
        {
            string[] myParams = new string[] { "@PetitionID", "@ShiftCode" };
            object[] myValues = new object[] { PetitionID, ShiftCode };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_PROCESS_PETITIONSHIFT_Insert", myParams, myValues);
        }

        [DisplayName("PetitionID"), Category("Column")]
        public Guid PetitionID
        {
            get
            {
                return this.m_PetitionID;
            }
            set
            {
                this.m_PetitionID = value;
            }
        }

        public string ProductName
        {
            get
            {
                return "Class HRM_PROCESS_PETITIONSHIFT";
            }
        }

        public string ProductVersion
        {
            get
            {
                return "1.0.0.0";
            }
        }

        [Category("Column"), DisplayName("ShiftCode")]
        public string ShiftCode
        {
            get
            {
                return this.m_ShiftCode;
            }
            set
            {
                this.m_ShiftCode = value;
            }
        }
    }
}

